<extend name="public:base"/>

<block name="left">

    <div class="mark_bar cl">
        <a href="{:url('user/index/index')}" class="goback fl"><i class="iconfont">&#xe600;</i></a>
        <p>提现</p>
        <a href="{:url('user/withdraw/log')}" class="btm">提现记录</a>
    </div>

</block>

<block name="main">
    <div class="container">
        <div class="form">
            <form action="{:url('user/withdraw/handle')}" method="post" id="form">
                <div class="withdraw">

                    <div class="withdraw_card">
                        <p class="small">提现方式</p>

                        <select name="type" id="type" class="select">
                            <foreach name="$way" item="v">
                                <option value="{$key}">{$v}</option>
                            </foreach>
                        </select>

                        <div class="cl"></div>
                    </div>

                    <div class="withdraw_input">
                        <p class="small">提现金额</p>
                        <div class="cl">
                            <span class="abs">¥</span>
                            <input id="money" name="money" autocomplete="off" autofocus type="text" size="11"
                                   maxlength="11"
                                   onkeyup="this.value=checkingMoney(this.value);" class="pt05"/>
                        </div>
                        <p class="small pt05" id="showmoney">当前可提现金额：<span id="account_money">{$account_money}</span> 元，
                            <a href="javascript:withdrawAll();" class="blue">全部提现</a>
                        </p>
                        <p id="cashCommission" class="small pt05 hide">手续费：<em id="fee">2</em>元</p>
                        <p class="small red pt05 hide" id="errortips"></p>
                    </div>
                </div>
                <div class="wrap">
                    <input type="submit" value="提现" class="submit" id="withdraw"/>
                </div>
            </form>

        </div>


        <div class="tips pt1">
            <p class="red">温馨提示：</p>
            <p>
                1.{$min}元起提；<br/>
                2.信用卡不得设为提现银行卡；<br/>
                3.请确保您的提现信息正确，以免影响您的到账时间；<br/>
                <!--3.请确保您的提现银行卡四要素（银行卡号、开户人姓名、身份证、预留手机号）与您的平台账户四要素（绑定银行卡号、实名认证姓名、身份证、验证手机号）一致；<br/>-->
                4.工作日提现T+1到账，非工作日顺延；<br/>
                5.单笔提现收费{$rate}/笔计扣；用户注册后从未经任何一轮投资即提现，按提现金额的1.5‰计扣提现费（最低2元）。
            </p>
        </div>

    </div>

    <div id="pay_info" class="openframe hide">
        <div class="mark_bar invest_mark_bar">
            <a href="javascript:;" onclick="movebot('pay_info');" class="goback fl"><i class="iconfont">&#xe602;</i></a>
            <p>输入支付密码</p>
        </div>
        <div class="openframe_content cl">
            <div class="pay_pass pay_pass_index index fl" data-index="1">
                <input type="password" class="input_t password" name="pass" maxlength="6" value="" id="password0"
                       required/>
                <div class="cl"></div>
                <a href="javascript:void(0);" onclick="submit_first()" class="submit">提交</a>
            </div>
        </div>
    </div>

</block>

<block name="menu"></block>

<block name="js">
    <style type="text/css">
        .select {
            width: 100%;
            height: 2rem;
            border: 0;
            font-size: 0.75rem;
            margin-top: 0.3rem;
        }
    </style>
    <script type="text/javascript" src="__JS__/check.js?v={:config('app_ver')}"></script>
    <script type="text/javascript">
        function withdrawAll() {
            $('#money').val($('#account_money').text());
        }

        $(function () {

            // var is_company_borrow = parseInt("{:session('user_auth.user_type')}");

            // $("#InvestMoney").change(function () {
            //     var val = parseFloat($(this).find("option:selected").attr("data-money"));
            //     if (val) {
            //         $("#money").prop('readonly', true).val(val);
            //         $("#form").prop("action", "{:url('uc/withdraw/borrow_withdraw')}")
            //     } else {
            //         $("#money").val('').prop('readonly', false);
            //         $("#form").prop("action", "{:url('uc/withdraw/withdraw')}")
            //     }
            // });


            var withdraw_mn = {$min};
            var withdraw_fee = {$rate};


            $("#money").keyup(function () {

                var value = parseFloat($(this).val());
                var id = "#cashCommission";
                var fee = "#fee";
                var feeMoney = 0;

                if (value >= withdraw_mn) {
                    $(id).removeClass("hide");
                    feeMoney = parseInt(value * withdraw_fee * 100) / 100;
                    $(fee).html(feeMoney);

                } else {
                    $(id).addClass("hide");
                    $(fee).html('0');
                }
            });

            $("#form").submit(function () {
                // var is_borrow_id = $("#InvestMoney").val();
                // if (is_company_borrow == 2 && is_borrow_id) {
                var withmaxmoney = parseFloat($('#account_money').text());

                if (withmaxmoney < withdraw_mn) {
                    wjtips('可提现金额金额至少' + withdraw_mn + '元以上');
                    return false;
                }
                return ajax_post($(this), "", "", "", "申请提现中");
            });


        });

    </script>
</block>